#ifndef SURFACE_WIDGET_H
#define SURFACE_WIDGET_H

#include <QGLWidget>
#include <boost/scoped_ptr.hpp>
#include <core/util/manipulator.h>

namespace widgets {

  class Surface_widget : public QGLWidget
  {
    Q_OBJECT

  public:
    Surface_widget(QWidget *parent = 0);
    ~Surface_widget();

    public slots:
      void set_pan(qreal x_pan, qreal y_pan);
      void set_rotation(qreal z_axis, qreal x_axis);
      void set_zoom(qreal);
      void set_proportion(qreal);
      void set_scale(qreal);

  protected:
    virtual void initializeGL();
    virtual void paintGL();
    virtual void resizeGL(int width, int height);
    virtual void mouseMoveEvent(QMouseEvent *);
    virtual void mousePressEvent(QMouseEvent *);
    virtual void mouseReleaseEvent(QMouseEvent *);
    virtual void wheelEvent(QWheelEvent *);

  private:
    Input_filter input_filter_;

    Manipulator *Surface_widget::make_pan_manipulator(const QPoint &pos);
    Manipulator *Surface_widget::make_rotate_manipulator(const QPoint &pos);
    Manipulator *Surface_widget::make_zoom_manipulator(const QPoint &pos);
    Manipulator *Surface_widget::make_proportion_manipulator(const QPoint &pos);
    Manipulator *Surface_widget::make_scale_manipulator(const QPoint &pos);
    void zoom_in();
    void zoom_out();

    QPointF pan_;
    QPointF rotation_;
    qreal zoom_;
    qreal proportion_;
    qreal scale_;

  };
} // namespace widgets {
#endif // SURFACE_WIDGET_H
